﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace 第三章
{
    public partial class _3__6 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnSub_Click(object sender, EventArgs e)
        {
            //数组实现
            string[] arr = this.TXTnum.Text.Split(' ');
            int[] numArr = Array.ConvertAll(arr, int.Parse);
            Array.Sort(numArr);
            Response.Write("数组实现<br/>");
            for (int i = numArr.Length - 1; i >= 0; i--)
            {
                Response.Write(numArr[i] + "<br/>");
            }

            //List<T>泛型实现
            Response.Write("List<T>泛型实现<br/>");
            List<int> numList = new List<int>(numArr);
            numList.Sort((x,y) => -x.CompareTo(y));
            foreach (var item in numList)
            {
                Response.Write(item + "<br/>");
            }




        }
    }
}